package client;

import java.util.*;

public class test {

    public static void main(String[] args) {
        List<Map<String,Object>> list = new ArrayList<>();
        Map<String,Object> map1 = new HashMap<>();
        Map<String,Object> map2 = new HashMap<>();
        map2.put("k",100);
        map2.put("k2","200L");
       /* map1 = null;

        list.add(map1);
        list.add(map2);
        System.out.println(list.toString());*/
        /*for (String key : map2.keySet()) {
            System.out.println(key+"-->"+map2.get(key));

        }*/
        /*
        //取出map2的键放入set中，通过迭代器遍历存入set中的键
        Set<String> set = map2.keySet();
        Iterator<String> iterator = set.iterator();
        while (iterator.hasNext()){
            String next = iterator.next();
            System.out.println(next+"-->"+map2.get(next));
        }
*/
        //取出map2中的每一组数据（键值对）,通过getKey()和getValue()得到每组键值对的键与值
        Set<Map.Entry<String, Object>> entries = map2.entrySet();
        Iterator<Map.Entry<String, Object>> entryIterator = entries.iterator();
        while (entryIterator.hasNext()){
            Map.Entry<String, Object> next = entryIterator.next();

            System.out.println(next.getKey()+"-->"+next.getValue());
        }
    }
}
